/**
 * @mbggenerated
 * @author wujian
 */
package bearworker.zxl.dao.mapper;

import bearworker.zxl.entity.DeliveryUserShare;
import org.apache.ibatis.jdbc.SQL;

public class DeliveryUserShareSqlProvider {

    /* @mbggenerated */
    public String insertSelective(DeliveryUserShare record) {
        return new SQL() {
            {
                INSERT_INTO("delivery_user_share");

                if (record.getId() != null) {
                    VALUES("id", "#{id,jdbcType=INTEGER}");
                }

                if (record.getUserId() != null) {
                    VALUES("user_id", "#{userId,jdbcType=INTEGER}");
                }

                if (record.getShareUrl() != null) {
                    VALUES("share_url", "#{shareUrl,jdbcType=VARCHAR}");
                }

                if (record.getTicket() != null) {
                    VALUES("ticket", "#{ticket,jdbcType=VARCHAR}");
                }

                if (record.getExpiresTime() != null) {
                    VALUES("expires_time", "#{expiresTime,jdbcType=TIMESTAMP}");
                }

                if (record.getCreateTime() != null) {
                    VALUES("create_time", "#{createTime,jdbcType=TIMESTAMP}");
                }

            }
        }.toString();
    }

    /* @mbggenerated */
    public String updateByPrimaryKeySelective(DeliveryUserShare record) {
        return new SQL() {
            {
                UPDATE("delivery_user_share");

                if (record.getUserId() != null) {
                    SET("user_id = #{userId,jdbcType=INTEGER}");
                }

                if (record.getShareUrl() != null) {
                    SET("share_url = #{shareUrl,jdbcType=VARCHAR}");
                }

                if (record.getTicket() != null) {
                    SET("ticket = #{ticket,jdbcType=VARCHAR}");
                }

                if (record.getExpiresTime() != null) {
                    SET("expires_time = #{expiresTime,jdbcType=TIMESTAMP}");
                }

                if (record.getCreateTime() != null) {
                    SET("create_time = #{createTime,jdbcType=TIMESTAMP}");
                }

                WHERE("id = #{id,jdbcType=INTEGER}");

            }
        }.toString();
    }
}